from django.shortcuts import render
from stgapp.models import *

# Create your views here.
def test(request):
    customerid = request.GET.get("customerid") if request.GET.get("customerid") else ""
    request.session['customerid'] = customerid
    return render(request, 'strategy.html', locals())


def test_detail(request):
    stgid = request.GET.get("stgid") if request.GET.get("stgid") else ""
    stgfile = ""
    if TBackapproval.objects.using("BackTestDB").filter(stgid=stgid).exists():
        stgfile = TBackapproval.objects.using("BackTestDB").values("stgfile").filter(stgid=stgid).first().get("stgfile")
    return render(request, 'stgdetail.html', locals())
